﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ModelPredictPro.General.IO;

namespace ModelPredictPro.General {
    public class DataSet {
        Sample[] _samples;
        public int Count { get; private set; }

        public DataSet(IEnumerable<Sample> samples) {
            _samples = samples.ToArray();
            Count = samples.Count();
        }

        public Sample this[int index] {
            get {
                return _samples[index];
            }
            set {
                _samples[index] = value;
            }
        }

        #region static
        public static DataSet Load(string FilePath) {
            List<Sample> samplelist = new List<Sample>();
            foreach (string line in FileReader.ReadAllLines(FilePath)) {
                Sample s = (Sample)line;
                samplelist.Add(s);
            }
            //IEnumerable<Sample> samples = samplelist;
            DataSet rst = new DataSet(samplelist);
            return rst;
        }
        #endregion
    }

}
